<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		圆的半径：<input type=text" id="input1"/>
		<button onclick="calc()">计算面积</button>
		<button onclick="calc2()">计算周长</button>
		
		<script>
			
			console.log(Math.PI);
			function calc(){
				var r = parseFloat(input1.value);
				var area = Math.PI * r * r;
				alert("圆的面积为：" + area);
				
			}
			
			// 计算圆的周长
			function calc2(){
				var r = parseFloat(input1.value);
				var length = Math.PI * 2 * r;
				alert("圆的周长为：" + length);
				
			}
			
			// Math.abs()求绝对值
			console.log(Math.abs(-10));
			// Math.round()四舍五入
			consolele.log(Math.ground(4.4));
			console.log(Math.ground(4.5));
			// Math.ceil() 天花板 向上取整
			console.log(Math.ceil(4.4));
			// Math.floor() 地板 向下取整
			console.log(Math.floor(4.4));
			// Math.pow()
			console.log(Math.pow(2,10));
			// Math.sqrt()
			console.log(Math.sqrt(16));
			// Math.random()	0-1随机小数
			console.log(Math.random());
		</script>
		
		
	</body>
</html>
